home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.text.rtf;
-
- import javax.swing.text.Style;
- import javax.swing.text.rtf.RTFReader.StylesheetDestination;
-
- class RTFReader$StylesheetDestination$StyleDefiningDestination extends RTFReader.AttributeTrackingDestination implements RTFReader.Destination {
- // $FF: synthetic field
- private final RTFReader.StylesheetDestination this$1;
- final int STYLENUMBER_NONE;
- boolean additive;
- boolean characterStyle;
- boolean sectionStyle;
- public String styleName;
- public int number;
- int basedOn;
- int nextStyle;
- boolean hidden;
- Style realizedStyle;
-
- public RTFReader$StylesheetDestination$StyleDefiningDestination(RTFReader.StylesheetDestination var1) {
- super(StylesheetDestination.access$0(var1));
- this.this$1 = var1;
- this.STYLENUMBER_NONE = 222;
- this.additive = false;
- this.characterStyle = false;
- this.sectionStyle = false;
- this.styleName = null;
- this.number = 0;
- this.basedOn = 222;
- this.nextStyle = 222;
- this.hidden = false;
- }
-
- public void close() {
- int var1 = this.styleName.indexOf(59);
- if (var1 > 0) {
- this.styleName = this.styleName.substring(0, var1);
- }
-
- this.this$1.definedStyles.put(new Integer(this.number), this);
- super.close();
- }
-
- public boolean handleKeyword(String var1) {
- if (var1.equals("additive")) {
- this.additive = true;
- return true;
- } else if (var1.equals("shidden")) {
- this.hidden = true;
- return true;
- } else {
- return super.handleKeyword(var1);
- }
- }
-
- public boolean handleKeyword(String var1, int var2) {
- if (var1.equals("s")) {
- this.characterStyle = false;
- this.sectionStyle = false;
- this.number = var2;
- } else if (var1.equals("cs")) {
- this.characterStyle = true;
- this.sectionStyle = false;
- this.number = var2;
- } else if (var1.equals("ds")) {
- this.characterStyle = false;
- this.sectionStyle = true;
- this.number = var2;
- } else if (var1.equals("sbasedon")) {
- this.basedOn = var2;
- } else {
- if (!var1.equals("snext")) {
- return super.handleKeyword(var1, var2);
- }
-
- this.nextStyle = var2;
- }
-
- return true;
- }
-
- public void handleText(String var1) {
- if (this.styleName != null) {
- this.styleName = this.styleName + var1;
- } else {
- this.styleName = var1;
- }
-
- }
-
- public Style realize() {
- Style var1 = null;
- Style var2 = null;
- if (this.realizedStyle != null) {
- return this.realizedStyle;
- } else {
- if (this.basedOn != 222) {
- RTFReader$StylesheetDestination$StyleDefiningDestination var3 = (RTFReader$StylesheetDestination$StyleDefiningDestination)this.this$1.definedStyles.get(new Integer(this.basedOn));
- if (var3 != null) {
- var1 = var3.realize();
- }
- }
-
- this.realizedStyle = StylesheetDestination.access$0(this.this$1).target.addStyle(this.styleName, var1);
- if (this.characterStyle) {
- this.realizedStyle.addAttributes(((RTFReader.AttributeTrackingDestination)this).currentTextAttributes());
- this.realizedStyle.addAttribute("style:type", "character");
- } else if (this.sectionStyle) {
- this.realizedStyle.addAttributes(((RTFReader.AttributeTrackingDestination)this).currentSectionAttributes());
- this.realizedStyle.addAttribute("style:type", "section");
- } else {
- this.realizedStyle.addAttributes(((RTFReader.AttributeTrackingDestination)this).currentParagraphAttributes());
- this.realizedStyle.addAttribute("style:type", "paragraph");
- }
-
- if (this.nextStyle != 222) {
- RTFReader$StylesheetDestination$StyleDefiningDestination var4 = (RTFReader$StylesheetDestination$StyleDefiningDestination)this.this$1.definedStyles.get(new Integer(this.nextStyle));
- if (var4 != null) {
- var2 = var4.realize();
- }
- }
-
- if (var2 != null) {
- this.realizedStyle.addAttribute("style:nextStyle", var2);
- }
-
- this.realizedStyle.addAttribute("style:additive", new Boolean(this.additive));
- this.realizedStyle.addAttribute("style:hidden", new Boolean(this.hidden));
- return this.realizedStyle;
- }
- }
- }
-